﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace LibFriesland_Campina_CRM
{
    class DalProductCatalouge
    {
        #region Dung cho Webservice
        //Lay danh sach ProductCatalouge : product_catalouge_charid - name
        public static List<BizProductCatalouge> getAll()
        {
            Friesland_Campina_CRM_DataContext db = new Friesland_Campina_CRM_DataContext(new MySqlConnection(Thuvien.getConnString()));
            try
            {
                var productCatalouges = from pdc in db.ProductCatALouGe
                                        select new BizProductCatalouge(pdc.ProductCatalogueCharID, pdc.Name, Convert.ToBoolean(pdc.Owner));
                return productCatalouges.ToList();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        #endregion
    }
}
